home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.0 / card_9386.txt < prev    next >
Text File  |  1989-02-26  |  3KB  |  117 lines

  1. -- card: 9386 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3837
  5. -- name: NewFileName
  6. ----- HyperTalk script -----
  7. on closecard
  8.   hide message window
  9. end closecard
  10.  
  11.  
  12. -- part 1 (button)
  13. -- low flags: 00
  14. -- high flags: A004
  15. -- rect: left=224 top=243 right=293 bottom=283
  16. -- title width / last selected line: 0
  17. -- icon id / first selected line: 27056 / 27056
  18. -- text alignment: 1
  19. -- font id: 0
  20. -- text size: 12
  21. -- style flags: 0
  22. -- line height: 16
  23. -- part name: Try it
  24. ----- HyperTalk script -----
  25. on mouseUp
  26.   put NewFileName("Your File Name","Isn't this great?!")
  27. end mouseUp
  28.  
  29.  
  30.  
  31. -- part 2 (button)
  32. -- low flags: 00
  33. -- high flags: A003
  34. -- rect: left=82 top=302 right=324 bottom=182
  35. -- title width / last selected line: 0
  36. -- icon id / first selected line: 0 / 0
  37. -- text alignment: 1
  38. -- font id: 0
  39. -- text size: 12
  40. -- style flags: 0
  41. -- line height: 16
  42. -- part name: Install
  43. ----- HyperTalk script -----
  44. on mouseUp
  45.   if the optionkey is down then
  46.     pass mouseup
  47.   end if
  48.  
  49.   put (long name of this stack) into sourceStack
  50.   delete first word of sourceStack
  51.   delete first character of sourceStack
  52.   delete last character of sourceStack
  53.   put "Select a stack to copy this resource into."
  54.   put filename("STAK") into fname
  55.   if fname is empty then
  56.     hide message window
  57.     exit mouseup
  58.   end if
  59.   if sourcestack=fname then
  60.     beep
  61.     Answer "Get real.  You can't install it in this stack"
  62.     hide message window
  63.     exit mouseup
  64.   end if
  65.  
  66.   --
  67.   ModResCopy sourceStack,fname,"XFCN","NewFileName"
  68.   --
  69.   get the result
  70.   if first char of it is "E" then
  71.     put it into the message box
  72.     beep
  73.     answer "Attempt to install resource has failed."
  74.   else
  75.     beep
  76.     answer "Resource installation successful"
  77.   end if
  78.   hide message window
  79. end mouseUp
  80.  
  81.  
  82.  
  83. -- part contents for background part 5
  84. ----- text -----
  85. NewFileName
  86.  
  87. -- part contents for background part 10
  88. ----- text -----
  89. 2
  90.  
  91. -- part contents for background part 6
  92. ----- text -----
  93.  
  94. This will allow you to use a Standard File Package 'Save' dialog box in your hypertalk scripts
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. Thanks to:
  104. Andrew Gilmartin
  105. Brown University
  106.  
  107. -- part contents for background part 7
  108. ----- text -----
  109. Syntax:
  110.  
  111. put NewFileName( <prompt>, 
  112. <initial filename> ) into SaveFileName
  113.  
  114. <prompt>, should be a simple descriptive statement about the request, such as,  "Save document as?," or  "Save test result to:."
  115.  
  116. <initial filename>.  The first time NewFileName is called this should be  empty (‚Äú‚Äù) as the user is saving an untitled document.  Thereafter, it should contain the name of the document as previously given by the user. 
  117.